﻿@inject IStringLocalizer<EditorDoMethodAsync> Localizer

<Editor IsEditor="true" @ref="Editor" />
<div class="mt-3">
    <Button OnClick="InsertHtmlAsync">@Localizer["DoMethodAsyncButton1"]</Button>
    <Button OnClick="@(async () => await Editor.DoMethodAsync("formatH2", ""))">@Localizer["DoMethodAsyncButton2"]</Button>
    <Button OnClick="@(async () => await Editor.DoMethodAsync("insertImage", "https://www.blazor.zone/_content/BootstrapBlazor.Shared/images/avatars/150-1.jpg", "tree"))">@Localizer["DoMethodAsyncButton3"]</Button>
</div>

@code {
    [NotNull]
    private Editor? Editor { get; set; }

    private async Task InsertHtmlAsync()
    {
        await Editor.DoMethodAsync("pasteHTML", $"<h1>{Localizer["DoMethodAsyncPasteHTML"]}</h1>");
    }
}
